<template>
  <div class="watcher">
    <p>看值的变化：${{num}}</p>
    <button @click="num+=1">增加</button>
  </div>
</template>

<script>
export default {
  name: '',
  data () {
    return {
      num: 0
    }
  },
  watch: {
    num: {
      handler (newVal, oldVal) {
        console.log(newVal + '  ,   ' + oldVal)
      }
    }
  }
}
</script>

<style lang="less" scoped></style>
